module CnSms
  module Adapter
    class Base
      def initialize(config)
        raise RuntimeError("must implement")
      end

      def send(phone,msg)
        if (msg.size > 160)
          raise SMSError, "text to long"
        end
        match_phone = phone.to_s =~ /55[0-9]{10}/
        if (match_phone.nil?)
          raise SMSError, "phone number incorrect format (#{phone})"
        end
      end
    end
  end
end